package com.system.service;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.system.dao.FoodDaoImpl;
import com.system.dao.IFoodDao;
import com.system.entity.FoodClassify;
import com.system.entity.FoodInfo;
import com.system.util.PieChartData;

public class FoodServiceImpl implements IFoodService {
	IFoodDao foodDao = new FoodDaoImpl();
	public List<FoodClassify> foodClassifiesList(String keyword) {
		List<FoodClassify> list = new ArrayList<FoodClassify>();
		try {
			list = foodDao.foodClassifiesList(keyword);
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	public String changeFoodClassify(FoodClassify foodClassify,String oldID) {
		try {
			return foodDao.changeFoodClassify(foodClassify,oldID);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "0";
	}
	public String addFoodClassify(FoodClassify foodClassify) {
		try {
			return foodDao.addFoodClassify(foodClassify);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "0";
	}
	public String deleteFoodClassify(String classifyNum) {
		try {
			return foodDao.deleteFoodClassify(classifyNum);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "0";
	}
	public List<FoodInfo> foodInfoList(String keyword) {
		List<FoodInfo> list = new ArrayList<FoodInfo>();
		try {
			list = foodDao.foodInfoList(keyword);
			return list;
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	public String addFoodInfo(FoodInfo foodInfo) {
		try {
			return foodDao.addFoodInfo(foodInfo);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "0";
	}
	public String changeFoodInfo(FoodInfo foodInfo, String oldID) {
		try {
			return foodDao.changeFoodInfo(foodInfo,oldID);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "0";
	}
	public String deleteFoodInfo(String foodNum) {
		try {
			return foodDao.deleteFoodInfo(foodNum);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return "0";
	}
	public PieChartData pieChartData() {
		try {
			return foodDao.pieChartData();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

}
